//
//  FindPasswordViewController.m
//  XIWenLeJian
//
//  Created by lanou3g on 15/11/16.
//  Copyright © 2015年 蓝足. All rights reserved.
//

#import "FindPasswordViewController.h"
#import <AVOSCloud/AVOSCloud.h>

@interface FindPasswordViewController ()

@property (strong, nonatomic) IBOutlet UITextField *emailTextField;

@end

@implementation FindPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"nav_chbackbtn"] style:(UIBarButtonItemStylePlain) target:self action:@selector(back)];
    [self.navigationItem.leftBarButtonItem setTintColor:[UIColor whiteColor]];
}

- (void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (IBAction)trueButton:(id)sender{
    
    [AVUser requestPasswordResetForEmailInBackground:_emailTextField.text block:^(BOOL succeeded, NSError *error) {
        
        if (succeeded) {
            UIAlertView *aler =[[UIAlertView alloc] initWithTitle:@"提示" message:@"修改连接已发送到邮箱" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil];
            
            [aler show];
            
            [self.navigationController popToRootViewControllerAnimated:YES ];
            
        }else{
            UIAlertView *aler =[[UIAlertView alloc] initWithTitle:@"提示" message:@"邮箱不正确" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil];
            [aler show];
        }
        
    }];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
